﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Speech.Synthesis;//引用命名空间

namespace MyTest
{
    /// <summary>
    /// 教员:薛海
    /// 微信:xuehai03
    /// QQ:289477003
    /// 语音提示
    /// 2019-2-20
    /// </summary>
    public partial class frmSpeak : Form
    {
        public frmSpeak()
        {
            InitializeComponent();
        }

        //读取
        private void btnRead_Click(object sender, EventArgs e)
        {
            //获得文本框内容
            string str = this.txtName.Text.Trim();
            //声明语音对象
            SpeechSynthesizer sys = new SpeechSynthesizer();
            //语音读取内容
            sys.Speak(str);
        }
    }
}
